class WrongNumberOfPlayersError < StandardError ; end
class WrongNumberOfElementsError < StandardError ; end
class NoSuchStrategyError < StandardError ; end
def players_number_check(game)
	raise WrongNumberOfPlayersError unless game.length == 2
	true
end
def elements_number_check(game)
	game.each{|x| raise WrongNumberOfElementsError unless x.length == 2}
	true
end
def strategy_check(game)
	game.each{|x| s = x[1].downcase
	raise NoSuchStrategyError unless (s == 'r') or (s == 's')  or (s == 'p')}
	true
end
def winner(a, b)
	q = a[1].downcase
	w = b[1].downcase
	if q==w
		"returns the list [" + a.join(', ') + "] wins since " + a[1] + "=" + b[1]
	elsif q == 'r'
		if w =='s'
			"returns the list [" + a.join(', ') + "] wins since " + a[1] + ">" + b[1]
		else
			"returns the list [" + b.join(', ') + "] wins since " + b[1] + ">" + a[1]
		end
	elsif q == 'p'
		if w == 'r'
			"returns the list [" + a.join(', ') + "] wins since " + a[1] + ">" + b[1]
		else
			"returns the list [" + b.join(', ') + "] wins since " + b[1] + ">" + a[1]
		end
	else q == 's'
		if w == 'p'
			"returns the list [" + a.join(', ') + "] wins since " + a[1] + ">" + b[1]
		else
			"returns the list [" + b.join(', ') + "] wins since " + b[1] + ">" + a[1]
		end
	end
end
def rps_game_winner(game)
	players_number_check(game)
	elements_number_check(game)
	strategy_check(game)
	winner(game[0], game[1])
end